package com.wanxi.type;

import java.util.Arrays;

public class Sort {
    public static void main(String[] args) {
        String str = "91 33 5 6 7";
        String[] arrStr = str.split(" ");
        int length = arrStr.length;
        int[] arr = new int[length];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(arrStr[i]);
            System.out.print(arr[i] + ",");
        }
        int[] sort = sort(arr);
        System.out.println(Arrays.toString(sort));
    }

    private static int[] sort(int[] arr) {
//        int max = arr[0];
        for (int i = 0; i < arr.length - 1; i++) {

            if (arr[i] > arr[i + 1]) {
                int temp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = temp;
            }
        }
        return arr;
    }
}
